﻿<!--
  Copyright (c) Microsoft Corporation.  All rights reserved. 
  File: MainWindow.xaml
-->
 <Window x:Class="ParallelBoids.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Boids" Height="724" Width="861" WindowStyle="ThreeDBorderWindow" Icon="/Boids;component/Images/Annotate_Complete.ico"
        MouseWheel="Window_MouseWheel" MouseDoubleClick="Window_MouseDoubleClick" KeyDown="Window_KeyDown" MouseDown="Window_MouseDown" MouseMove="Window_MouseMove" Loaded="Window_Loaded">

    <Window.Background>
        <ImageBrush ImageSource="/Boids;component/Images/Sky.jpg" Viewport="0,0,2,2" TileMode="Tile" />
    </Window.Background>

    <Viewport3D Name="viewport3D" Margin="0,10,0,0" MinWidth="0" MinHeight="0" >
        <Viewport3D.Camera>
            <PerspectiveCamera x:Name="camMain" Position="0,50,400" LookDirection="0, 0, -1" FarPlaneDistance="1600" UpDirection="0,1,0" NearPlaneDistance="1" FieldOfView="70" />
        </Viewport3D.Camera>

        <!-- Direct lights. -->
        <ModelVisual3D>
            <ModelVisual3D.Content>
                <DirectionalLight Direction="0, -1, 0">
                    <DirectionalLight.Transform>
                        <TranslateTransform3D OffsetX="0" OffsetY="200" OffsetZ ="0"/>
                    </DirectionalLight.Transform>
                </DirectionalLight>
            </ModelVisual3D.Content>
        </ModelVisual3D>
        <ModelVisual3D>
            <ModelVisual3D.Content>
                <DirectionalLight Direction="0, -.4, -1">
                    <DirectionalLight.Transform>
                        <TranslateTransform3D OffsetX="250" OffsetY="1000" OffsetZ ="450" />
                    </DirectionalLight.Transform>
                </DirectionalLight>
            </ModelVisual3D.Content>
        </ModelVisual3D>

        <ModelVisual3D>
            <ModelVisual3D.Content>
                <DirectionalLight Direction="0, .4, -1">
                    <DirectionalLight.Transform>
                        <TranslateTransform3D OffsetX="250" OffsetY="-1000" OffsetZ ="450" />
                    </DirectionalLight.Transform>
                </DirectionalLight>
            </ModelVisual3D.Content>
        </ModelVisual3D>

        <!-- 3D plane. -->
        <ModelVisual3D>
            <ModelVisual3D.Content>

                <GeometryModel3D>
                    <GeometryModel3D.Geometry>
                        <MeshGeometry3D
                                 TriangleIndices="0,1,2 3,4,5 "
                                 Normals="0,1,0 0,1,0 0,1,0 0,1,0 0,1,0 0,1,0 "
                                 TextureCoordinates="0,0 1,0 1,1 1,1 0,1 0,0 "
                                 Positions="-1,-1,1 1,-1,1 1,1,1 1,1,1 -1,1,1 -1,-1,1 " />
                    </GeometryModel3D.Geometry>

                    <GeometryModel3D.BackMaterial>
                        <MaterialGroup>
                            <DiffuseMaterial>
                                <DiffuseMaterial.Brush>
                                    <ImageBrush ImageSource="/Boids;component/Images/Grass.jpg" Viewport="0,0,0.1,0.2" TileMode="Tile" />
                                </DiffuseMaterial.Brush>
                            </DiffuseMaterial>
                        </MaterialGroup>
                    </GeometryModel3D.BackMaterial>

                    <GeometryModel3D.Material>
                        <MaterialGroup>
                            <DiffuseMaterial>
                                <DiffuseMaterial.Brush>
                                    <ImageBrush ImageSource="/Boids;component/Images/Grass.jpg" Viewport="0,0,0.1,0.2" TileMode="Tile" />
                                </DiffuseMaterial.Brush>
                            </DiffuseMaterial>
                        </MaterialGroup>
                    </GeometryModel3D.Material>

                    <GeometryModel3D.Transform>
                        <Transform3DGroup>
                            <RotateTransform3D>
                                <RotateTransform3D.Rotation>
                                    <AxisAngleRotation3D x:Name="myAngleRotation" Axis="1,0,0" Angle="90" />
                                </RotateTransform3D.Rotation>
                            </RotateTransform3D>
                            <ScaleTransform3D ScaleX="300" ScaleY="0" ScaleZ="400" />
                        </Transform3DGroup>
                    </GeometryModel3D.Transform>

                </GeometryModel3D>
            </ModelVisual3D.Content>
        </ModelVisual3D>

    </Viewport3D>
</Window>
